package com.xudayong.Demo;
//斐波那契数列的验证
public class Demo01 {
    public static void main(String[] args) {
        aa b = new aa();
        System.out.println(b.sum(1));
    }
     static class aa{
        public int sum(int i ) {
            //条件是i>=1
            if (i >= 1) {
                if (i == 1 || i == 2) {
                    return 1;
                } else {
                    return sum(i - 1)+sum(i-2) ;
                }
            } else {
                System.out.println("你的输入有误");
                return -1;
            }
        }
    }
}
